package com.chenye.service;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Auther:liangxp
 * @Data:2017/10/30
 * @Description:消息队列
 *
 */
@Configuration
public class RabbitTopicConfig {
    public static final String DEFAULT_EXCHANGE = "test.zipkin";

    @Bean
    public Queue indexsQueue() {
        return new Queue("test.zipkin");
    }
    @Bean
    TopicExchange defaultExchange() {
        return new TopicExchange(RabbitTopicConfig.DEFAULT_EXCHANGE);
    }

    @Bean
    public Binding bindingExchangeMessages(Queue adapterQueue, TopicExchange defaultExchange) {
        return BindingBuilder.bind(adapterQueue).to(defaultExchange).with("test.zipkin");
    }
}
